package com.base.myproject.client.busi;

import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import com.extjs.gxt.ui.client.data.ModelData;
/**
 * ��ݿ�ÿ�м�¼
 * @author zgw
 *
 */
public class JDBCModelData implements ModelData{

	
	//行的状态
	final static int RWO_NOTHING = 0; //插入
	final static int ROW_INSERT = 1; //插入
	final static int ROW_DELETE = 2; //删除
	final static int ROW_UPDATE = 4; //更新
	int status = 0;
	 protected Map map;
	public JDBCModelData(Map<String, Object> properties)
	{
	    super();
	    setProperties(properties);
	    
	}
	@Override
	public Object get(String property) {

		return map == null ? null :  map.get(property);
	}

	@Override
	public Map<String, Object> getProperties() {
		return map;
	}

	@Override
	public Collection<String> getPropertyNames() {
		 Set<String> set = new HashSet<String>();
		    if (map != null) {
		      set.addAll(map.keySet());
		    }
		    return set;
	}

	@Override
	public <X> X remove(String property) {
		 return map == null ? null : (X) map.remove(property);
	}

	@Override
	public <X> X set(String property, X value) {
		 if (map == null) {
		      map = new java.util.HashMap();
		    }
		
		    return (X) map.put(property, value);
	}
	 public void setProperties(Map<String, Object> properties) {
		    for (String property : properties.keySet()) {
		      set(property, properties.get(property));
		    }
		  }
	 /**
	  * 获取当前行的状态
	  * @return
	  */
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	 
}
